package fr.insta.reverse.uml.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import fr.insta.reverse.uml.service.ServiceFactory;
import fr.insta.reverse.uml.service.ServiceName;
import fr.insta.reverse.uml.service.ServiceProject;

public class AccueilController extends DefaultController
{

	public AccueilController(HttpServletRequest _request, HttpServletResponse _response)
	{
		super(_request, _response);
	}

	@Override
	public void execute()
	{
		if (request.getMethod() == "POST")
		{
			System.out.println("POST");
			System.out.println(request.getParameter("hash"));

			if (request.getParameter("hash") != null)
			{
				ServiceProject serviceProjet = (ServiceProject) ServiceFactory.getService(ServiceName.ServiceProject);
				System.out.println(serviceProjet.getByImageHash(request.getParameter("hash")));
			}
		}

		dispatch("accueil");
	}
}